package com.yun.zf.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yun.zf.common.app.domain.ZfFollow;
import com.yun.zf.common.app.dto.follow.FollowDto;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 房源关注表 Mapper 接口
 * </p>
 *
 * @author cj
 * @since 2021-05-27
 */
public interface ZfFollowMapper extends BaseMapper<ZfFollow> {


    /**
     * 用户关注数据去重
     * @param userId
     * @param type
     * @return
     */
    @Select("<script>" +
            " SELECT  DISTINCT province_code,city_code,city_name from zf_follow WHERE  follow_type=#{type} AND user_id=#{userId} " +
            "</script>")
    List<FollowDto> getFollowCitys(Long userId,int type);

    @Select("<script>" +
            " SELECT  horc_id from zf_follow WHERE  city_code=#{cityCode} AND  province_code=#{prov} AND user_id=#{userId} " +
            "</script>")
    List<Long> getIds(Long userId,Long prov ,Long cityCode);
}
